package com.ruoyi.system.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.Yjzyfwd;
import com.ruoyi.system.service.IYjzyfwdService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * YjzyfwdController
 * 
 * @author ruoyi
 * @date 2025-07-01
 */
@RestController
@RequestMapping("/system/yjzyfwd")
public class YjzyfwdController extends BaseController
{
    @Autowired
    private IYjzyfwdService yjzyfwdService;

    /**
     * 查询Yjzyfwd列表
     */
    @PreAuthorize("@ss.hasPermi('system:yjzyfwd:list')")
    @GetMapping("/list")
    public TableDataInfo list(Yjzyfwd yjzyfwd)
    {
        startPage();
        List<Yjzyfwd> list = yjzyfwdService.selectYjzyfwdList(yjzyfwd);
        return getDataTable(list);
    }

    /**
     * 导出Yjzyfwd列表
     */
    @PreAuthorize("@ss.hasPermi('system:yjzyfwd:export')")
    @Log(title = "Yjzyfwd", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Yjzyfwd yjzyfwd)
    {
        List<Yjzyfwd> list = yjzyfwdService.selectYjzyfwdList(yjzyfwd);
        ExcelUtil<Yjzyfwd> util = new ExcelUtil<Yjzyfwd>(Yjzyfwd.class);
        util.exportExcel(response, list, "Yjzyfwd数据");
    }

    /**
     * 获取Yjzyfwd详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:yjzyfwd:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(yjzyfwdService.selectYjzyfwdById(id));
    }

    /**
     * 新增Yjzyfwd
     */
    @PreAuthorize("@ss.hasPermi('system:yjzyfwd:add')")
    @Log(title = "Yjzyfwd", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Yjzyfwd yjzyfwd)
    {
        return toAjax(yjzyfwdService.insertYjzyfwd(yjzyfwd));
    }

    /**
     * 修改Yjzyfwd
     */
    @PreAuthorize("@ss.hasPermi('system:yjzyfwd:edit')")
    @Log(title = "Yjzyfwd", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Yjzyfwd yjzyfwd)
    {
        return toAjax(yjzyfwdService.updateYjzyfwd(yjzyfwd));
    }

    /**
     * 删除Yjzyfwd
     */
    @PreAuthorize("@ss.hasPermi('system:yjzyfwd:remove')")
    @Log(title = "Yjzyfwd", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(yjzyfwdService.deleteYjzyfwdByIds(ids));
    }
}
